package com.wgl.express.entity;

public class Package {

    // package id
    private int pid;
    // from user
    private String fromname;
    private String toname;
    private String fromphone;
    private String tophone;
    private String fromaddress;
    private String toaddress;
    private Float price;
    private String pickcode;
    // 1揽件中 2已入库 3已上架 4已出库
    private int status;

    public Package(int pid, String fromname, String toname, String fromphone, String tophone, String fromaddress, String toaddress, Float price, String pcikcode, int status) {
        this.pid = pid;
        this.fromname = fromname;
        this.toname = toname;
        this.fromphone = fromphone;
        this.tophone = tophone;
        this.fromaddress = fromaddress;
        this.toaddress = toaddress;
        this.price = price;
        this.pickcode = pcikcode;
        this.status = status;
    }

    public Package() { }

    public String getMaskFromAddress(){
        return this.fromaddress.substring(0,this.fromaddress.indexOf('市')+1);
    }

    public String getMaskToAddress(){
        return this.toaddress.substring(0,this.toaddress.indexOf('市')+1);
    }


    public String getMaskFromPhone(){
        return this.fromphone.substring(0, 3) +
                "****" +
                this.fromphone.substring(7, 11);
    }
    public String getMaskToPhone(){
        return this.tophone.substring(0, 3) +
                "****" +
                this.tophone.substring(7, 11);
    }


    public int getPid() {
        return pid;
    }

    // all getter/setter methods

    public void setPid(int pid) {
        this.pid = pid;
    }

    public String getFromname() {
        return fromname;
    }

    public void setFromname(String fromname) {
        this.fromname = fromname;
    }

    public String getToname() {
        return toname;
    }

    public void setToname(String toname) {
        this.toname = toname;
    }

    public String getFromphone() {
        return fromphone;
    }

    public void setFromphone(String fromphone) {
        this.fromphone = fromphone;
    }

    public String getTophone() {
        return tophone;
    }

    public void setTophone(String tophone) {
        this.tophone = tophone;
    }

    public String getFromaddress() {
        return fromaddress;
    }

    public void setFromaddress(String fromaddress) {
        this.fromaddress = fromaddress;
    }

    public String getToaddress() {
        return toaddress;
    }

    public void setToaddress(String toaddress) {
        this.toaddress = toaddress;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getPickcode() {
        return pickcode;
    }

    public void setPickcode(String pickcode) {
        this.pickcode = pickcode;
    }

    @Override
    public String toString() {
        return "Package{" +
                "pid=" + pid +
                ", fromname='" + fromname + '\'' +
                ", toname='" + toname + '\'' +
                ", fromphone='" + fromphone + '\'' +
                ", tophone='" + tophone + '\'' +
                ", fromaddress='" + fromaddress + '\'' +
                ", toaddress='" + toaddress + '\'' +
                ", price=" + price +
                ", status=" + status +
                '}';
    }
}
